# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.757.13.8 -> 1.757.13.9 # fs/binfmt_misc.c 1.5 -> 1.6 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/11/13 bjorn_helgaas@hp.com 1.757.16.4 # ia64: Restore "fake PCI device" support, for XFree86. This is intended # to go away in 2.5.x. # -------------------------------------------- # 02/11/13 helgaas@build.helgaas 1.757.16.5 # Merge build.helgaas:/home/helgaas/bk/to-marcelo-2.4 # into build.helgaas:/home/helgaas/bk/linux-ia64-2.4 # -------------------------------------------- # 02/11/13 helgaas@build.helgaas 1.757.12.6 # Merge bk://lia64@bkbits.net/linux-ia64-2.4 # into build.helgaas:/home/helgaas/bk/linux-ia64-2.4 # -------------------------------------------- # 02/11/13 jenna.s.hall@intel.com 1.757.29.1 # ia64: Minor MCA bugfixes. # -------------------------------------------- # 02/11/13 davidm@hpl.hp.com 1.757.13.9 # [PATCH] let binfmt_misc optionally preserve argv[1] # # This makes it possible for binfmt_misc to optionally preserve the # contents of argv[1]. This is needed for building accurate simulators # which are invoked via binfmt_misc. I had brought up this patch a while # ago (see URL below) and there was no negative feedback (OK, there was no # feedback at all... ;-). # # The patch is trivial and the new behavior is triggered only if the # letter "P" (for "preserve") is appended to the binfmt_misc registration # string, so it shold be completely safe. # # http://groups.google.com/groups?q=mosberger+binfmt_misc&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=200209092241.g89MfPS5001013%40napali.hpl.hp.com&rnum=1 # -------------------------------------------- # diff -Nru a/fs/binfmt_misc.c b/fs/binfmt_misc.c --- a/fs/binfmt_misc.c Wed Oct 8 09:09:12 2003 +++ b/fs/binfmt_misc.c Wed Oct 8 09:09:12 2003 @@ -35,6 +35,7 @@ static int enabled = 1; enum {Enabled, Magic}; +#define MISC_FMT_PRESERVE_ARGV0 (1<<31) typedef struct { struct list_head list; @@ -121,7 +122,9 @@ bprm->file = NULL; /* Build args for interpreter */ - remove_arg_zero(bprm); + if (!(fmt->flags & MISC_FMT_PRESERVE_ARGV0)) { + remove_arg_zero(bprm); + } retval = copy_strings_kernel(1, &bprm->filename, bprm); if (retval < 0) goto _ret; bprm->argc++; @@ -286,6 +289,11 @@ *p++ = '\0'; if (!e->interpreter[0]) goto Einval; + + if (*p == 'P') { + p++; + e->flags |= MISC_FMT_PRESERVE_ARGV0; + } if (*p == '\n') p++;